import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { VehicleBasicInfoVO, VehicleBasicInfoForm, VehicleBasicInfoQuery } from '@/api/vehicle/vehicleBasicInfo/types';

/**
 * 查询车辆基本信息列表
 * @param query
 * @returns {*}
 */

export const listVehicleBasicInfo = (query?: VehicleBasicInfoQuery): AxiosPromise<VehicleBasicInfoVO[]> => {
  return request({
    url: '/vehicle/vehicleBasicInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询车辆基本信息详细
 * @param id
 */
export const getVehicleBasicInfo = (id: string | number): AxiosPromise<VehicleBasicInfoVO> => {
  return request({
    url: '/vehicle/vehicleBasicInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增车辆基本信息
 * @param data
 */
export const addVehicleBasicInfo = (data: VehicleBasicInfoForm) => {
  return request({
    url: '/vehicle/vehicleBasicInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改车辆基本信息
 * @param data
 */
export const updateVehicleBasicInfo = (data: VehicleBasicInfoForm) => {
  return request({
    url: '/vehicle/vehicleBasicInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除车辆基本信息
 * @param id
 */
export const delVehicleBasicInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/vehicle/vehicleBasicInfo/' + id,
    method: 'delete'
  });
};
